package com.mcy.test01.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.jws.WebParam;
import javax.servlet.http.HttpSession;
import java.util.Map;

@Controller
public class LoginController {
    @GetMapping("/user/login")
    @ResponseBody
    public String login(String username, String password, Model model, HttpSession session){
        System.out.println(username);
        System.out.println(password);
       if(!StringUtils.isEmpty(username)&&"123456".equals(password)){
           session.setAttribute("loginUser",username);
           return "ok";
       }else{
           return "用户名密码错误";
       }
    }
}
